﻿<%@ Page Language="C#" AutoEventWireup="true"
    Inherits="admin_finance_financerecordlist" Codefile="financerecordlist.aspx.cs" %>

<%@ Register Src="~/admin/_root/_controls/ctlNavBar.ascx" TagName="ctlNavBar" TagPrefix="uc1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title>Finance Record</title>

    <script type="text/javascript">
     var LOCID_POPUP_MENU_LABEL ="{0}菜单";
    var LOCID_UNRECOGNIZE_DOTC="{0} 不是可识别的对象类型。";
    var LOCID_COPY_SHORTCUT_ERROR="无法将此快捷方式复制到剪贴板。";
    var LOCID_ENTER_VALID_NUMBER ="必须输入有效的数字。";

    //Lookup(global、lookup)
    var LOCID_LU_SELECT_VALUE_FOR="单击以选择{0}的值。";
    var LOCID_LU_SELECT_VALUE="单击以选择值。";
    var LOCID_LU_LOOKUPUNRESOLVEDTOOLTIP="未找到任何匹配项";
    var LOCID_LU_LOOKUPAMBIGUOUSTOOLTIP="已找到多个匹配项";
    var LOCID_UI_DIR="LTR";
    var LOCID_DIALOG_OFFSET_WIDTH=0;
    var LOCID_DIALOG_OFFSET_HEIGHT=0;
    var LOCID_ERROR_DIALOG_WIDTH=550;
    var LOCID_ERROR_DIALOG_HEIGHT=260;
    var LOCID_CONTRACTS_TDIALOG_WIDTH=350;
    var LOCID_CONTRACTS_TDIALOG_HEIGHT =350;
    var LOCID_LOOKUPSTYLE_NOT_SET="未知的查找样式。请检查属性 XML 的设置是否正确。";
    var LOCID_LOOKUPAMBIGUOUSTITLE="已找到多个匹配项:";
    var LOCID_LOOKMORERECORDS_AMBIGUOUS="查找更多记录";
    var DEFAULT_USER_NUMBER_FORMAT_MASK="\x23,\x23\x230.\x2a\x3b\x7e\x23,\x23\x230.\x2a";
    var USER_NUMBER_FORMAT_MASK="\x23,\x23\x230.\x2a\x3b\x7e\x23,\x23\x230.\x2a";

    //Calendar Control -->Date
    var LOCID_SHOW_WEEK_CAL_WIDTH="170";
    var LOCID_NO_WEEK_CAL_WIDTH="150";
    var LOCID_CALENDAR_HEIGHT="163";
    var USER_SHOW_WEEK_NUMBER=false;
    var USER_IS_GREGORIANCALENDAR=true;
    var ORG_DATE_START_DAY ="0";
    var USER_DATE_SEPARATOR="-";
    var USER_DATE_FORMATSTRING="yyyy/M/d";
    var LOCID_ALERT_ENTER_VALID_DATE="指定的日期格式无效或日期超出了有效范围。请按以下格式输入有效的日期: {0}";
    var USER_DATE_FORMATTED_FORMATSTRING="yyyy/M/d";
    var LOCID_YEAR_DISPLAYFORMAT="{0}{1} 年";
    var LOCID_ARRAY_SHORT_MONTHS="1 月,2 月,3 月,4 月,5 月,6 月,7 月,8 月,9 月,10 月,11 月,12 月";
    var LOCID_ARRAY_LONG_MONTHS="一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一月,十二月,";
    var LOCID_ARRAY_SHORTEST_DAYS="日,一,二,三,四,五,六";
    var LOCID_ARRAY_LONG_DAYS ="星期日,星期一,星期二,星期三,星期四,星期五,星期六";
    var LOCID_SHOW_WEEK_CAL_WIDTH="170";
    var LOCID_NO_WEEK_CAL_WIDTH="150";
    var LOCID_CALENDAR_HEIGHT="163";
    var LOCID_TODAY_DATE_FORMAT_MASK="今天:{0}";
    var LOCID_ALERT_CALDATE_FAIL="获取日期时出错";
    var LOCID_ALERT_ACTUAL_DATE_FAIL="获取日期时出错";
    var LOCID_DTM_BLANK_DATE_ERROR="必须提供日期。";

    //action
    var LOCID_NO_ASTERISK="搜索字段不得包含星号 (*) 字符。请移除任何使用过的字符，然后重试。";

    //Grid
    var LOCID_GRID_SELECT_ALL_KEY = "A";
    var LOCID_LOADING_GRID_DATA ="Loading Data...";
    var LOCID_REFRESH_GRID_CANCELLED ="刷新已取消。";
    var LOCID_LOADING_GRID_FAILED ="网格刷新失败。";
    var LOCID_ALT_COLUMNSORTORDER_DOWN ="数据按降序存储在该列中";
    var LOCID_ALT_COLUMNSORTORDER_UP ="数据按升序存储在该列中";
    /*
        自定义排序
    */
    var LOCID_VARIABLE_FILTER="flipv()";//刷新前状态
    var LOCID_VARIABLE_FIELDNAME="";//所选列列名
    var LOCID_VARIABLE_FIELD="";//排序字段
    var LOCID_VARIABLE_LEVEL="";//排序级别
    var LOCID_VARIABLE_OLDFIELDNAME="";
    
    var WEB_APP_URL = "";
    var HELP_SKU = "OP";
    var _saveAndNewEnabled = true;
    var IS_LIVE = false;
    var IS_PATHBASEDURLS = true;
    var ORG_UNIQUE_NAME = "webs";
    var _ErrorCodesIsvAborted = "0x80040265";
    var ScriptErrorReportingPreference = 1;
    var ScriptErrorStatusBar = "\u7f51\u9875\u4e0a\u6709\u9519\u8bef\u3002";
    var _bPresenceEnabled = true;
    var ORG_DATE_FORMATSTRING = "yyyy\x2fM\x2fd";
    var ORG_IS_GREGORIANCALENDAR = false;
    var ORG_DATE_SEPARATOR = "-";
    var ORG_DATE_START_DAY = 0;
    var ORG_LANGUAGE_CODE = 2052;
    var ORG_NUMBER_FORMAT_MASK = "\x23,\x23\x230.\x2a\x3b\x7e\x23,\x23\x230.\x2a";
    var ORG_TIME_FORMAT = 0;
    var ORG_SHOW_WEEK_NUMBER = false;
    var ORG_NUMBER_DECIMAL_SEPARATOR = ".";
    var ORG_NUMBER_GROUP_SEPARATOR = ",";
    var AUTHENTICATION_TYPE = 0;
    var ORG_TIMEZONE_OFFSET = 480;
    var USER_IS_GREGORIANCALENDAR = true;
    var USER_DATE_FORMATTED_FORMATSTRING = "yyyy\x2fM\x2fd";
    var DEFAULT_USER_NUMBER_FORMAT_MASK = "\x23,\x23\x230.\x2a\x3b\x7e\x23,\x23\x230.\x2a";
    var USER_LANGUAGE_CODE = 2052;
    var USER_HELP_LCID = "2052";
    var USER_NUMBER_DECIMAL_SEPARATOR = ".";
    var USER_NUMBER_GROUP_SEPARATOR = ",";
    var HELP_SERVER_URL = "";
    </script>

    <script type="text/javascript" src="../_static/_common/scripts/encodedecode.js"></script>

    <script type="text/javascript" src="../_static/_controls/util/util.js"></script>

    <script type="text/javascript" src="../_static/_common/scripts/global.js"></script>

    <script type="text/javascript" src="../_static/_common/scripts/xmlutil.js"></script>

    <script type="text/javascript" src="../_static/_controls/remotecommands/remotecommand.js"></script>

    <script type="text/javascript" src="../_common/windowinformation/windowinformation.js"></script>

    <script type="text/javascript" src="../_static/_common/scripts/stage.js"></script>

    <script type="text/javascript" src="../_static/crmreports/reports.js"></script>

    <script type="text/javascript" src="../_static/_common/scripts/presence.js"></script>

    <script type="text/javascript" src="../_static/_controls/lookup/lookup.js"></script>

    <script type="text/javascript" src="../_static/_grid/action.js"></script>

    <script type="text/javascript" src="../_static/_forms/addrelated.js"></script>

    <script type="text/javascript" src="../_static/_controls/datetime/date.js"></script>

    <script type="text/javascript" src="../_static/_controls/datetime/time.js"></script>

    <script type="text/javascript" src="../_static/_jQuery/jquery-1.3.2.min.js"></script>

    <script language="javascript" src="../_static/_jQuery/jquery_json.js" type="text/javascript"></script>

    <script language="javascript" src="../_static/_jQuery/jquery_stringutil.js" type="text/javascript"></script>

    <link rel="stylesheet" type="text/css" href="../_common/styles/global.css" />
    <link rel="stylesheet" type="text/css" href="../_common/styles/global-styles.css" />
    <link rel="stylesheet" type="text/css" href="../_common/styles/global-dynamic-styles.css" />
    <link rel="stylesheet" type="text/css" href="../_common/styles/fonts.css" />
    <link rel="stylesheet" type="text/css" href="../_nav/menu.css" />
    <link rel="stylesheet" type="text/css" href="../_forms/controls/controls.css" />
    <link rel="stylesheet" type="text/css" href="../_common/styles/minical.css" />
    <link rel="stylesheet" type="text/css" href="../_nav/tabs.css" />
    <link rel="stylesheet" type="text/css" href="../_static/_controls/datenavigationbar/datenavigationbar.css" />
    <link rel="stylesheet" type="text/css" href="../_controls/relatedinformation/relatedinformation.css" />
    <link rel="stylesheet" type="text/css" href="../_controls/relatedinformation/category.css" />
    <link rel="stylesheet" type="text/css" href="../_grid/appgrid.css" />

    <script language="JavaScript" type="text/javascript">
    function LocalDateTimeNow() 
    {
        var dNow = new Date();
        dNow.setMinutes(dNow.getMinutes() + (dNow.getTimezoneOffset()) + ORG_TIMEZONE_OFFSET);
        return dNow; 
    }
    function window.onload()
    {
        LoadSubcategoryList();
        LoadingData();
    }
    var pageIndex = "";
    function pagination(index)
    {
        pageIndex = index;
        LoadingData();
    }
    function LoadingData()
    {
        $.ajax({
               type:    "POST",
               url:     "financerecordlist.aspx",
               data:    {
                        otype:      "loaddata",
                        index:      pageIndex, 
                        field:      LOCID_VARIABLE_FIELD,
                        level:      LOCID_VARIABLE_LEVEL,
                        typecode:   GetQueryString("typecode"),
                        category:   $("#selCategoryList").val(),
                        subcategory:   $("#selSubategoryList").val(),
                        statuscode:   $("#selStatus").val(),
                        year:   $("#dropYear").val(),
                        month:   $("#dropMonth").val()
               },
               beforeSend:function(){
                    $("#divloading").css("display","block");
                    $("#divItemsList").html('');
               },
               success: function(res, textStatus){
                    $("#divloading").css("display","none");
                    $("#divItemsList").html(res);
               }
          }); 
    }
    
    function Lookup()
    {
        pageIndex = "";
        LoadingData();
    }
    function OpenDia(otype)
    {
        /// 修改模式
        if(otype == "modify")
        {
            var oTr = getSelectedOTr("crmGrid", getSelected("crmGrid")[0]);
            if(oTr)
            {
                openStdWin(prependOrgName("/admin/finance/financerecordeditor.aspx?financerecordid=" + oTr.oid + "&otype=modify&typecode="+GetQueryString("typecode")), buildWinName(), 525, 425); 
            }
            else
            {
                alert("Please select the records!");
            }
        }
        /// 添加模式
        if(otype == "add")
        { 
            openStdWin(prependOrgName("/admin/finance/financerecordeditor.aspx?otype=add&typecode="+GetQueryString("typecode")), buildWinName(), 525, 425); 
        }
    }
    function Delete()
	{
	    var oTr = getSelectedOTr("crmGrid", getSelected("crmGrid")[0]);
        if(oTr)
        {
            if(confirm("Are you sure you want to do this?"))
            {
                  $.post(
                       "financerecordlist.aspx",
                       {    
                            otype:      'delete',
                            financerecordid:     oTr.oid
                       },
                       function(res){
                            if (res == "succeeded")
                            {
                                alert("Successfully removed!");
                                LoadingData();
                            }
                            else
                                alert(res);
                       }
                  );
              }
        }
        else
            alert("Please select the records!");
	}
	
	function LoadSubcategoryList()
	{
	    if($("#selCategoryList").val() != "")
	    {
            $.ajax({
                async   :   false,
                type    :   "POST",
                url     :   "financerecordeditor.aspx",
                data    :   { otype : "getsubcategorylist", categoryid : $("#selCategoryList").val() },
                success :   function(data, textStatus) {
                    $("#selSubategoryList").emptySelect().append(data);
                }
            });
        }
        else
        {
            $("#selSubategoryList").emptySelect().append("<option value=''>-- Select --</option>"); 
        }
	}
    </script>

    <style type="text/css">
        .navArea
        {
            background: url(      '../../website_admin/_imgs/admin/tab/tab_05_1.gif' ) repeat-x;
            width: 100%;
            height: 32px;
            line-height: 32px;
        }
        .navBar
        {
            background: url(      '../../website_admin/_imgs/admin/tab/tb.gif' ) no-repeat 12px;
            border-bottom: #dddddd 1px solid;
            padding-left: 32px;
            width: 100%;
        }
    </style>
</head>
<body class="stage">
    <form id="form1" runat="server">
    <table class="stdTable" cellspacing="0" cellpadding="0">
        <colgroup>
            <col />
        </colgroup>
        <tr>
            <td class="navArea">
                <div class="navBar">
                    <uc1:ctlNavBar ID="CtlNavBar1" runat="server" />
                </div>
            </td>
        </tr>
        <tr class="ms-crm-Form-Background" height="100%">
            <td id="tdAreas" style="padding: 5px 5px 5px 5px;">
                <table class="stdTable" cellpadding="0" cellspacing="0">
                    <colgroup>
                        <col />
                    </colgroup>
                    <tr style="height: 25px;">
                        <td>
                            <table class="homepage_table" cellspacing="0" cellpadding="0" width="100%">
                                <colgroup>
                                    <col width="50px" style="text-align: right;" />
                                    <col width="150px;" />
                                    <col width="150px;" />
                                    <col width="50px" style="text-align: right;" />
                                    <col width="280px;" /> 
                                    <col />
                                </colgroup>
                                <tbody>
                                    <tr>
                                        <td class="homepage_td" nowrap>
                                            <label for="selCategoryList" style="font-weight: bold; color: #000000">
                                                Category:
                                            </label>
                                        </td>
                                        <td>
                                            <select class="ms-crm-SelectBox" id="selCategoryList" name="selCategoryList" runat="server">
                                            </select>
                                        </td>
                                        <td>
                                            <select class="ms-crm-SelectBox" id="selSubategoryList" name="selSubategoryList">
                                            </select>
                                        </td> 
                                        <td class="homepage_td" nowrap>
                                            <label for="dropYear" style="font-weight: bold; color: #000000">
                                                Year:
                                            </label>
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="dropYear" runat="server" CssClass="ms-crm-SelectBox" Style="width: 80px;">
                                            </asp:DropDownList>
                                            ～
                                            <asp:DropDownList ID="dropMonth" runat="server" CssClass="ms-crm-SelectBox" Style="width: 120px;">
                                            </asp:DropDownList>
                                        </td>
                                        <td class="homepage_td" nowrap style="display: none;">
                                            <label for="selStatus" style="font-weight: bold; color: #000000">Status:</label>
                                        </td>
                                        <td style="display: none;">
                                            <select class="ms-crm-SelectBox" id="selStatus" name="selStatus">
                                                <option value="">-- Select --</option>
                                                <option value="0">Not Approve</option>
                                                <option value="1">Approved</option>
                                            </select>
                                        </td>
                                        <td>
                                            <button id="btnSearch" onclick="Lookup();">
                                                Search
                                            </button>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                    <tr height="25">
                        <td>
                            <span id="crmMenuBar">
                                <table cellspacing="0" cellpadding="0" width="100%">
                                    <tbody>
                                        <tr>
                                            <td>
                                                <table class="ms-crm-ActionBar" id="mnuBar1" cellspacing="0" cellpadding="0">
                                                    <tbody>
                                                        <tr>
                                                            <td class="ms-crm-MenuBar-Items" nowrap align="right">
                                                                <ul class="ms-crm-MenuBar-Left">
                                                                    <li class="ms-crm-Menu" id="_MBAdd" onclick="window.execScript(action)" tabindex="-1"
                                                                        action="OpenDia('add');"><span class="ms-crm-Menu-Label"><a class="ms-crm-Menu-Label"
                                                                            onclick="return false;" tabindex="-1" href="javascript:onclick();" target="_self">
                                                                            <img class="ms-crm-Menu-ButtonFirst" tabindex="-1" alt="New" src="../_imgs/ico_18_reports.gif"><span
                                                                                class="ms-crm-MenuItem-TextRTL" tabindex="0">Add New</span></a></span></li>
                                                                    <li class="ms-crm-Menu-Spacer" tabindex="-1">&nbsp;<img id="ImgUpdate" style="background-position-y: -55px;
                                                                        background-image: url(../_imgs/imagestrips/control_imgs_1.gif); width: 4px; clip: rect(0px 4px 17px 0px);
                                                                        height: 17px" alt="" src="../_imgs/imagestrips/transparent_spacer.gif">&nbsp;</li>
                                                                    <li class="ms-crm-Menu" id="_MBUpdateUser" title="Modify User Info" onclick="window.execScript(action)"
                                                                        tabindex="-1" action="OpenDia('modify');"><span class="ms-crm-Menu-Label"><a class="ms-crm-Menu-Label"
                                                                            onclick="return false;" tabindex="-1" href="javascript:onclick();" target="_self"
                                                                            style="cursor: pointer;">
                                                                            <img class="ms-crm-Menu-ButtonFirst" id="ImgUpdateUser" style="width: 16px; height: 16px"
                                                                                tabindex="0" alt="Modify" src="../_imgs/ico_16_4207_d.gif"><span class="ms-crm-MenuItem-TextRTL"
                                                                                    tabindex="0">Modify</span></a></span></li>
                                                                    <li class="ms-crm-Menu-Spacer" tabindex="-1">&nbsp;<img id="Img2" style="background-position-y: -55px;
                                                                        background-image: url(../_imgs/imagestrips/control_imgs_1.gif); width: 4px; clip: rect(0px 4px 17px 0px);
                                                                        height: 17px" alt="" src="../_imgs/imagestrips/transparent_spacer.gif">&nbsp;</li>
                                                                    <li class="ms-crm-Menu" id="_MBdoUsersGrid4200delete" title="Delete" onclick="window.execScript(action)"
                                                                        tabindex="-1" action="Delete();"><span class="ms-crm-Menu-Label"><a class="ms-crm-Menu-Label"
                                                                            onclick="return false;" tabindex="-1" href="javascript:onclick();" target="_self">
                                                                            <img class="ms-crm-Menu-ButtonFirst" id="ico_16_delete" style="background-position-y: -121px;
                                                                                background-image: url(../_imgs/imagestrips/grid_ctrl_imgs.gif); width: 16px;
                                                                                clip: rect(0px 16px 16px 0px); height: 16px" tabindex="0" alt="Delete"
                                                                                src="../_imgs/imagestrips/transparent_spacer.gif"><span class="ms-crm-MenuItem-TextRTL"
                                                                                    tabindex="0">Delete</span></a></span></li>
                                                                </ul>
                                                            </td>
                                                            <td class="ms-crm-MenuBar-Items ms-crm-Menu-ICRight" nowrap>
                                                                <ul class="ms-crm-MenuBar-Right">
                                                                </ul>
                                                            </td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div id="divloading" style="display: none;">
                                <table class="stdTable" style="background-color: #FFFFFF; border: solid 1px #6699CC;"
                                    cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td style="vertical-align: middle" align="center">
                                            <img alt="" src="../_imgs/AdvFind/progress.gif" /><br />
                                            Loading data ...<input type="hidden" id="txtSortFieldName" name="txtSortFieldName"
                                                value="ChassisNo" /><input type="hidden" id="txtSortType" name="txtSortType" value="0" />
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <div id="divItemsList">
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
